﻿@model Inscriptionem.Areas.Inscriptionem.Models.Views.SectionCollectionViewModel

@{
    ViewBag.Title = "Inscriptionem » Sections";
    Layout = "../Shared/Layout.cshtml";

    ViewBag.CurrentPage = "Sections";
}

<div class="outer" id="contentwrap">
    @{Html.RenderPartial("NavigationMenu");}
    <div class="postcont">
		<div id="content">
            <div class="post type-post status-publish format-standard hentry">
                <h2 class="title">Sections</h2>
                <div class="postdate-single error-message"></div>

                <table width="100%">
                    <thead>
                        <tr class="postdate">
                            <td>Order</td>
                            <td>Section</td>
                            <td>Section Name</td>
                            <td>Is Default</td>
                            <td>Language</td>
                            <td>Language Name</td>
                            <td style="width: 60px;"></td>
                            <td style="width: 60px;"></td>
                        </tr>
                    </thead>
                    <tbody>
                    @foreach(var section in Model.Sections.OrderBy(s => s.Language.ID).ThenBy(s => s.ID))
                    {
                    <text>
                    <tr>
                        <td>@(section.Order)</td>
                        <td>@(section.Name)</td>
                        <td>@(section.LocalizedName)</td>
                        <td><input type="checkbox" @(section.IsDefault ? "checked" : string.Empty) disabled="disabled" /></td>
                        <td>@(section.Language.Name)</td>
                        <td>@(section.Language.LocalizedName)</td>
                        <td>
                            <form method="post" action="/Inscriptionem/Section/Edit">
                                <input type="hidden" name="ID" value="@(section.ID)" />
                                <input type="submit" value="Edit" />
                            </form>
                        </td>
                        <td>
                            <form method="post" action="/Inscriptionem/Section/Delete">
                                <input type="hidden" name="ID" value="@(section.ID)" />
                                <input type="submit" value="Delete" />
                            </form>
                        </td>
                    </tr>
                    </text>
                    }
                    <tr>
                        <td><a href="/Inscriptionem/Section/Order">Change</a></td>
                    </tr>
                    </tbody>
                </table>
                <hr />
                <form method="post" action="/Inscriptionem/Section/Add">
                    <div class="postdate">Add Section</div>
				    <div class="entry">
                        <p>Order <input type="text" name="Order" value="" /></p>
                        <p>Section <input type="text" name="Name" value="" /></p>
                        <p>Section Name <input type="text" name="LocalizedName" value="" /></p>
                        <p>Default <input type="checkbox" name="IsDefault" /></p>
                        <p>Language
                            <select name="Language">
                            @foreach (var language in Model.Languages)
                            { 
                            <text>
                            <option value="@language.ID">@language.Name / @language.LocalizedName</option>
                            </text>
                            }
                            </select>
                        </p>
	                </div>

                    <input type="reset" value="Reset" />&nbsp;|&nbsp;<input type="submit" value="Add" />
                </form>
			</div>
        </div>
	</div>	
</div>
